package com.cdy.jxc_project.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cdy.jxc_project.domain.TPurchaseListGoods;
import com.cdy.jxc_project.mapper.TPurchaseListGoodsMapper;
import com.cdy.jxc_project.service.TPurchaseListGoodsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/*
 * @Project:jxc_project
 * @Author:cdy(缘生)
 * @Motto:放下杂念,只为迎接明天更好的自己
 * @Date:2023/5/2 16:07
 * */
@Service
public class TPurchaseListGoodsServiceImpl extends ServiceImpl<TPurchaseListGoodsMapper, TPurchaseListGoods> implements TPurchaseListGoodsService {


    @Resource
    private TPurchaseListGoodsMapper tPurchaseListGoodsMapper;
    @Override
    public int insertTPurchaseListGoods(TPurchaseListGoods tPurchaseListGoods) {
        return tPurchaseListGoodsMapper.insert(tPurchaseListGoods);
    }

    @Override
    public List<TPurchaseListGoods> queryTPurchaseListGoods(String code) {

        QueryWrapper<TPurchaseListGoods> queryWrapper = new QueryWrapper();
        queryWrapper.eq("code" ,code);
        return tPurchaseListGoodsMapper.selectList(queryWrapper);
    }

    @Override
    public List<TPurchaseListGoods> queryAllTPurchaseListGoods() {
        return tPurchaseListGoodsMapper.selectList(null);
    }

    @Override
    public List<TPurchaseListGoods> queryTPurchaseListGoodsByTPurchaseListId(Integer id) {
        QueryWrapper<TPurchaseListGoods> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("purchase_list_id",id);
        return tPurchaseListGoodsMapper.selectList(queryWrapper);
    }
}
